<template>
  <div style="padding: 20px">
    <el-card>
      <div slot="header">企业会员日志</div>
      <el-row :gutter="10" type="flex" style="margin-top: 20px">
        <el-form
          ref="form"
          :model="form"
          label-width="80px"
          style="display: flex"
        >
          <el-form-item label="会员uid:"
            ><el-input clearable v-model.number="qyMembersQuery.uid" @keyup.enter.native="searchClick" placeholder="请输入uid"></el-input
          ></el-form-item>
          <el-form-item label="关键词:"
            ><el-input clearable v-model="qyMembersQuery.keyword" @keyup.enter.native="searchClick" placeholder="请输入关键词"></el-input
          ></el-form-item>
          <el-form-item label=""><el-button @click="searchClick">查询</el-button></el-form-item>
        </el-form>
      </el-row>
      <el-table :data="qyMembersList" style="width: 100%" max-height="600px">
        <el-table-column align="center" prop="uid" label="UID" width="100">
        </el-table-column>
        <el-table-column prop="addtime" label="时间" width="width" align="center">
          <template slot-scope="scope">
            {{ scope.row.addtime | dateFormat }}
          </template>
        </el-table-column>
        <el-table-column prop="content" label="操作" width="width" align="center"> 
        </el-table-column>
        <el-table-column prop="companyName" label="企业名称" width="width" align="center">
        </el-table-column>
        <el-table-column prop="ip" label="IP" width="width" align="center"></el-table-column>
        <el-table-column prop="ipAddr" label="IP归属地" width="width" align="center">
        </el-table-column>
        <el-table-column prop="platform" label="来源" width="width" align="center">
        </el-table-column>
      </el-table>
      <el-row :gutter="10" style="margin-top: 20px" type="flex" justify="end">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="qyMembersQuery.page"
          :page-sizes="[10, 20, 30,50]"
          :page-size="qyMembersQuery.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </el-row>
    </el-card>
  </div>
</template>

<script>
import { selCompanyLogApi } from "@/api/system";
export default {
  data() {
    return {
      list: [
        {
          id: 25739,
          utype: 1,
          uid: 2012,
          content: "签到",
          addtime: 1730267761,
          ip: "221.12.43.38:25298",
          ip_addr: "浙江省宁波市",
          platform: "web",
          is_login: 0,
          companyname: "北仑人才招聘",
          platform_cn: "电脑浏览器",
        },
        {
          id: 25738,
          utype: 1,
          uid: 2012,
          content: "登录成功",
          addtime: 1730267747,
          ip: "221.12.43.38:61032",
          ip_addr: "浙江省宁波市",
          platform: "web",
          is_login: 1,
          companyname: "北仑人才招聘",
          platform_cn: "电脑浏览器",
        },
        {
          id: 25737,
          utype: 1,
          uid: 2012,
          content: "登录成功",
          addtime: 1730267747,
          ip: "221.12.43.38:64726",
          ip_addr: "浙江省宁波市",
          platform: "web",
          is_login: 1,
          companyname: "北仑人才招聘",
          platform_cn: "电脑浏览器",
        },
        {
          id: 25736,
          utype: 1,
          uid: 2012,
          content: "登录成功",
          addtime: 1730267747,
          ip: "221.12.43.38:63616",
          ip_addr: "浙江省宁波市",
          platform: "web",
          is_login: 1,
          companyname: "北仑人才招聘",
          platform_cn: "电脑浏览器",
        },
        {
          id: 25726,
          utype: 1,
          uid: 1230,
          content: "登录成功",
          addtime: 1730256527,
          ip: "60.179.215.237:45050",
          ip_addr: "浙江省宁波市",
          platform: "mobile",
          is_login: 1,
          companyname: "宁波百盛人力资源服务有限公司北仑分公司",
          platform_cn: "手机浏览器",
        },
        {
          id: 25725,
          utype: 1,
          uid: 1230,
          content: "登录成功",
          addtime: 1730256527,
          ip: "60.179.215.237:41944",
          ip_addr: "浙江省宁波市",
          platform: "mobile",
          is_login: 1,
          companyname: "宁波百盛人力资源服务有限公司北仑分公司",
          platform_cn: "手机浏览器",
        },
        {
          id: 25724,
          utype: 1,
          uid: 1226,
          content: "下载简历【简历ID：1381】",
          addtime: 1730256354,
          ip: "60.179.215.237:20652",
          ip_addr: "浙江省宁波市",
          platform: "mobile",
          is_login: 0,
          companyname: "宁波劳联众维人力资源有限公司",
          platform_cn: "手机浏览器",
        },
        {
          id: 25721,
          utype: 1,
          uid: 1226,
          content: "下载简历【简历ID：1390】",
          addtime: 1730254413,
          ip: "60.179.215.237:23226",
          ip_addr: "浙江省宁波市",
          platform: "mobile",
          is_login: 0,
          companyname: "宁波劳联众维人力资源有限公司",
          platform_cn: "手机浏览器",
        },
        {
          id: 25720,
          utype: 1,
          uid: 1226,
          content:
            "套餐特权-免费刷新职位【北仑郭巨白洋线中宅村LNG招安检员1名】",
          addtime: 1730252902,
          ip: "60.179.215.237:49820",
          ip_addr: "浙江省宁波市",
          platform: "mobile",
          is_login: 0,
          companyname: "宁波劳联众维人力资源有限公司",
          platform_cn: "手机浏览器",
        },
        {
          id: 25719,
          utype: 1,
          uid: 1226,
          content: "设置职位招聘状态【招聘中】",
          addtime: 1730252893,
          ip: "60.179.215.237:35134",
          ip_addr: "浙江省宁波市",
          platform: "mobile",
          is_login: 0,
          companyname: "宁波劳联众维人力资源有限公司",
          platform_cn: "手机浏览器",
        },
      ],
      qyMembersQuery: {
        page: 1,
        pageSize: 10,
        uid: null,
        keyword: "",
      },
      total: "",
      qyMembersList: [],
    };
  },
  created() {
    this.selCompanyLog();
  },
  methods: {
    // 查询
    searchClick() {
      this.selCompanyLog();
    },
    // 页面数改变
    handleSizeChange(pageSize) {
      this.qyMembersQuery.pageSize = pageSize;
      this.selCompanyLog();
    },
    // 当前页面改变
    handleCurrentChange(page) {
      this.qyMembersQuery.page = page;
      this.selCompanyLog();
    },
    // 查询企业会员日志
    async selCompanyLog() {
      const res = await selCompanyLogApi(this.qyMembersQuery);
      console.log(res);
      this.qyMembersList = res.records;
      this.total = res.total;
    },
  },
};
</script>

<style scoped></style>
